package com.xspace.android.xafcommon.network.message;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.xspace.android.xafcommon.network.NetConstant;
import com.xspace.android.xafcommon.network.apn.ApnUtil;

public class ADataFlowControl implements IDataFlowControl {

	@Override
	public boolean isConnectInternet() {
		ConnectivityManager conManager = (ConnectivityManager) ApnUtil.context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo networkInfo = conManager.getActiveNetworkInfo();

		if (networkInfo != null) {

			return networkInfo.isAvailable();

		}
		return false;
	}

	@Override
	public boolean isOnline() {
		if (NetConstant.loginStatus) {
			return isConnectInternet();
		}
		return false;
	}

	@Override
	public boolean isOnlineLogin() {
		return NetConstant.loginStatus;
	}

}
